<h4 class="page-header text-center">CỔNG THÔNG TIN ĐĂNG NHẬP <br /><small>HOTROSALE.COM</small></h4>
<div class="panel panel-primary">
    <div class="panel-heading">Hệ thống người dùng</div>
    <div class="panel-body">
        <div class="row">
            <div class="col-lg-5 text-center">
                <form method="post" action="<?php echo base_url('chat/create'); ?>" id="fbForm" class="form-horizontal">
                    Chọn tài khoản đăng nhập:
                    <div>&nbsp;</div>
                    <div>
                        <a href="javascript:void(0)" onclick="login()" class="btn btn-danger col-lg-12">Đăng nhập bằng Google</a>
                    </div>
                    <div>&nbsp;</div>
                    <div>
                        <a href="javascript:void(0)" onclick="login()" class="btn btn-primary col-lg-12">Đăng nhập bằng Facebook</a>            
                    </div>                    
                </form>
            </div>
            <div class="col-lg-7">
                <div class="panel panel-danger">
                    <div class="panel-heading text-right">Đơn vị tài trợ</div>
                    <div class="panel-body">
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                        <div class="col-lg-4">
                            <a href="#" class="thumbnail">
                                <img src="http://www.cleverjobs.vn/cj/upload_files/images/thumbs/1/f/0/1f0ea9db10b1d2f870f3eee15b759c8d.jpg" alt="...">
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function login() {
            jQuery('#fbForm').html('Đang xác thực với Facebook....');
            FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {
                    jQuery.ajax({
                        url: '{base_url}user/authorize',
                        type: 'post',
                        data: {
                            access_token: response.authResponse.accessToken,
                        },
                        success: function(response) {                            
                            window.location = '{base_url}home';
                        },
                    });
                }
                else {
                    var uri = 'http://fbweb.local/login/success';
                    window.location = encodeURI("https://www.facebook.com/dialog/oauth?client_id=1423604761229658&redirect_uri=" + uri + "&response_type=token");
                    //FB.login();
                }
            });
        }
    </script>